struct{char n[16],p[21];int e;
}a[15],*m,*x;
main(i,w,s)
{
	m=a;x=a;
	for(gets(&i),s=i=0;~scanf("%s%d%s",a[i].n,&a[i].e,a[i].p);i++)
	{
		s+=a[i].e;
		m=m->e<a[i].e?m:&a[i];
		x=x->e>a[i].e?x:&a[i];
	}

	printf("average age : %d\nthe oldest : %s %s\nthe youngest : %s %s",s/i,x->n,x->p,m->n,m->p);
}
